1. Technical Field:
The present invention relates to data processing systems and, in particular, to collaborative data processing environments utilizing a client/server architecture. More particularly, the present invention relates to methods and systems for enhancing the performance of servers within client/server environments through caching.
2. Description of the Related Art:
The World Wide Web (Web) allows users of data-processing systems to retrieve vast amounts of electronic information via connections with remote server machines. This form of information dissemination is increasingly displacing more conventional media, such as newspapers, magazines, and even television. In the World Wide Web, clients obtain data by communicating with servers via the Internetxe2x80x94a combination of networks interconnected through routers and gateways. The clients and servers communicate using well-established protocols and standards for file exchange. For example, a standard for communication over the Internet consists of layering the Hypertext Transfer Protocol (HTTP) on top of the Transport Control Protocol/Internet Protocol combination (TCP/IP). Similarly, clients and servers exchange information in the form of well-established standards such as the Hypertext Markup Language (HTML) or the Portable Data Format (PDF), among many others.
Most interactions over the Internet today follow a client/server framework. Within that framework, the client is a process or program that requests a service provided by another programxe2x80x94the server. The client may utilize the requested service without having to xe2x80x9cknowxe2x80x9d the working details of the server program or of the requested service itself. The client and the server typically execute on different data processing systems (i.e., on the client machine and on the server machine, respectively).
Web servers implement the server side of the aforementioned protocols and provide clients with high-performance, secure and reliable access to information over the Internet. For example, in a stock-quotation service, the client sends HTTP requests to the server over the Internet, identifying a particular stock name. The server retrieves the desired information from one or more associated storage devices and sends back an appropriate reply to the client over the network. The server is responsible for ensuring that the client is authorized to have access to the requested information and that the request, if legal, executes as rapidly as possible to ensure good response time. High performance, therefore, is an important aspect in the design and implementation of a Web server.
Many factors affect the performance of a Web server. These factors include network speed and efficient operation of the components of the Web server, such as the server-side protocol implementation.
The present invention recognizes that Web servers may improve performance by caching the frequently requested URL documents (i.e., documents that are retrievable via Uniform Resource Locators). In particular, according to the present invention a server sets aside a portion of its address space to serve as a cache for storing those documents (which may include, without limitation, textual documents, graphics, documents containing both text and graphics, multimedia presentations, Java(copyright) applets, etc.) Thus, when a client requests a document that is already in the cache, the server can send the required information directly from its own memory. The server may utilize standard techniques for managing the space inside the cache, including policies on how to allocate and reallocate storage.
The caching technique of the present invention improves the performance of the Web server by allowing the server to obtain data required to service client requests without having to access either the disk or the operating system. Without caching, the Web server would be required to retrieve the required files from the operating system, which might be required to access the disk, and both of those steps would cause delays and performance degradation. The caching technique of the present invention saves the server from the overhead of accessing the operating system layers that implement the file system structure. Traversing these layers involves several context switches, which degrade the performance of the server under heavy load.
Based on the foregoing, it can be appreciated that a need exists for a method and system that enables servers (such as Web servers) to cache served documents and to serve those documents while enabling the servers to avoid repeated queries to the operating system. The present invention provides such a method and system.
The present invention provides a system and method in which a server program defines a server cache in RAM of a server machine and stores a selected file in the server cache. If a cached file is modified through the file system interface of the operating system of the server machine, the operating system automatically executes issues an upcall to the server program, the upcall identifying the modified file. In response to receipt of the upcall, the server program removes the modified file from the server cache.
In one embodiment, the server program responds to a client request requiring access to a requested file by obtaining the requested file from the server cache if the server cache contains that file. Otherwise, the server program calls the operating system to obtain the requested file and then adds that file to the server cache as a cached file. The server program then generates a result based on the requested file and transmits the result to the remote data processing system.
All objects, features, and advantages of the present invention will become apparent in the following detailed written description.